package geektime.spring.hello.hellospring.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import geektime.spring.hello.hellospring.entity.User;
import geektime.spring.hello.hellospring.service.UserService;

@RestController
@RequestMapping("user")
public class UserController {
	@Autowired
	private UserService userService;
	
	
	@RequestMapping("/add")
	public void add(@RequestBody User user) {
		userService.addUser(user);
	}
	@RequestMapping("/list")
	public IPage<User> queryAll(Page<User> page) {
		return userService.queryAll(page);
	}

}
